package com.lz.football.module.playerCenter.ModificationNumber
{
	import com.common.utils.Reflection;
	import com.liangzhong.model.playerCenter.vo.PlayerVo;
	import com.lz.football.module.base.IComponent;
	import com.lz.football.module.club.item.BaseItem;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;

	/**
	 * 修改号码ITem
	 * @author Administrator
	 * 
	 */	
	public class ModificationNumberItem extends Sprite implements IComponent
	{
		/**
		 * 
		 */
		private var _skin:MovieClip;
		/**
		 * 
		 */
		private var itemBase:BaseItem;
		private var _playerVo:PlayerVo;
		/**
		 * 
		 */
		private var number_1:MovieClip;
		/**
		 * 
		 */
		private var number_2:MovieClip;
		/**
		 *选择了item 
		 */
		private var _selectItem:BaseItem;
		private var _callBack:Function;
		public function ModificationNumberItem()
		{
			super();
		}
		
		public function initUI(view:Object=null):void
		{
			_skin = Reflection.createInstance("com.lz.modul.playerCenter.modificationNumber.Item");
			number_1 = _skin.number_1;
			number_2 = _skin.number_2;
			number_1.gotoAndStop(1);
			number_2.gotoAndStop(3);
			this.addChild(_skin);
			itemBase = new BaseItem();
			itemBase.initUI("com.lz.commonUI.ItemFrame");
			_skin.contain.addChild(itemBase);
//			itemBase.callBack = selectItem;
		}
		
		/**
		 *选择了item 
		 * @param $item
		 * 
		 */
//		private function selectItem($item:BaseItem):void
//		{
//			if(_selectItem != null)_selectItem.select = false;
//			_selectItem = $item;
//			_selectItem.select = true;
//		}
		public function addEvtListener():void
		{
		}
		
		public function removeEvtListener():void
		{
		}
		
		public function destroyView():void
		{
			removeEvtListener();
			_callBack = null;
			itemBase.destroyView();
			itemBase = null;
			_selectItem = null;
			if(this.parent)this.parent.removeChild(this);
			_skin = null;
		}

		/**
		 * 
		 */
		public function get playerVo():PlayerVo
		{
			return _playerVo;
		}

		/**
		 * @private
		 */
		public function set playerVo(value:PlayerVo):void
		{
			_playerVo = value;
			itemBase.data = _playerVo;
			itemBase.setImageSorce(_playerVo.starVo.bitmapData);
			upDataNumber();
		}
		/**
		 *变换号码 
		 * 
		 */
		public function upDataNumber():void
		{
//			if(_playerVo.number < 0)
//				number_1.gotoAndStop(1);
//			else
//				
				number_1.gotoAndStop(int(_playerVo.number/ 10) + 1);
			number_2.gotoAndStop((_playerVo.number % 10 )+ 1)
		}

		/**
		 *选择回调 
		 */
		public function get callBack():Function
		{
			return _callBack;
		}

		/**
		 * @private
		 */
		public function set callBack(value:Function):void
		{
			_callBack = value;
			itemBase.callBack = _callBack;
		}


	}
}